package cn.xiyun.xiyuncc.mediaFallback;

import cn.xiyun.xiyuncc.feignClient.MediaFeignClient;
import cn.xiyun.xiyuncc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MediaFallbackFactory implements FallbackFactory<MediaFeignClient> {
    @Override
    public MediaFeignClient create(Throwable cause) {
        return new MediaFeignClient() {
            @Override
            public JSONResult chapterMediaFile(Long id) {
                return JSONResult.error("视频资源服务异常");
            }

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error("视频资源服务异常");
            }
        };
    }
}
